home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / Multiprocessing.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  8.3 KB  |  365 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Multiprocessing.a
  3. ;
  4. ;    Contains:    Multiprocessing interfaces
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1996-1997 by Apple Computer, Inc. and © 1995-1997 DayStar Digital, Inc.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__MULTIPROCESSING__') = 'UNDEFINED' THEN
  19. __MULTIPROCESSING__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__CODEFRAGMENTS__') = 'UNDEFINED' THEN
  25.     include 'CodeFragments.a'
  26.     ENDIF
  27.  
  28.     IF TARGET_CPU_PPC THEN
  29.  
  30. MPLibrary_MajorVersion            EQU        1
  31. MPLibrary_MinorVersion            EQU        4
  32. MPLibrary_Release                EQU        1
  33. MPLibrary_DevelopmentRevision    EQU        2
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. ; typedef UInt32                         MPSemaphoreCount
  43.  
  44. ; typedef UInt32                         MPTaskOptions
  45.  
  46.  
  47. kDurationImmediate                EQU        0
  48. kDurationForever                EQU        $7FFFFFFF
  49.  
  50. kMPNoID                            EQU        0
  51.  
  52. ;
  53. ; extern UInt32 MPProcessors(void )
  54. ;
  55.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  56.         IMPORT_CFM_FUNCTION MPProcessors
  57.     ENDIF
  58.  
  59. ;
  60. ; extern OSStatus MPCreateTask(TaskProc entryPoint, void *parameter, ByteCount stackSize, MPQueueID notifyQueue, void *terminationParameter1, void *terminationParameter2, MPTaskOptions options, MPTaskID *task)
  61. ;
  62.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  63.         IMPORT_CFM_FUNCTION MPCreateTask
  64.     ENDIF
  65.  
  66.  
  67. ;
  68. ; extern OSStatus MPTerminateTask(MPTaskID task, OSStatus terminationStatus)
  69. ;
  70.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  71.         IMPORT_CFM_FUNCTION MPTerminateTask
  72.     ENDIF
  73.  
  74.  
  75. ;
  76. ; extern void MPExit(OSStatus status)
  77. ;
  78.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  79.         IMPORT_CFM_FUNCTION MPExit
  80.     ENDIF
  81.  
  82.  
  83. ;
  84. ; extern MPTaskID MPCurrentTaskID(void )
  85. ;
  86.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  87.         IMPORT_CFM_FUNCTION MPCurrentTaskID
  88.     ENDIF
  89.  
  90.  
  91. ;
  92. ; extern void MPYield(void )
  93. ;
  94.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  95.         IMPORT_CFM_FUNCTION MPYield
  96.     ENDIF
  97.  
  98.  
  99. ;
  100. ; extern OSStatus MPCreateQueue(MPQueueID *queue)
  101. ;
  102.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  103.         IMPORT_CFM_FUNCTION MPCreateQueue
  104.     ENDIF
  105.  
  106.  
  107. ;
  108. ; extern OSStatus MPDeleteQueue(MPQueueID queue)
  109. ;
  110.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  111.         IMPORT_CFM_FUNCTION MPDeleteQueue
  112.     ENDIF
  113.  
  114.  
  115. ;
  116. ; extern OSStatus MPNotifyQueue(MPQueueID queue, void *param1, void *param2, void *param3)
  117. ;
  118.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  119.         IMPORT_CFM_FUNCTION MPNotifyQueue
  120.     ENDIF
  121.  
  122.  
  123. ;
  124. ; extern OSStatus MPWaitOnQueue(MPQueueID queue, void **param1, void **param2, void **param3, Duration timeout)
  125. ;
  126.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  127.         IMPORT_CFM_FUNCTION MPWaitOnQueue
  128.     ENDIF
  129.  
  130.  
  131. ;
  132. ; extern OSStatus MPCreateSemaphore(MPSemaphoreCount maximumValue, MPSemaphoreCount initialValue, MPSemaphoreID *semaphore)
  133. ;
  134.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  135.         IMPORT_CFM_FUNCTION MPCreateSemaphore
  136.     ENDIF
  137.  
  138.  
  139.  
  140. ;
  141. ; extern OSStatus MPWaitOnSemaphore(MPSemaphoreID semaphore, Duration timeout)
  142. ;
  143.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  144.         IMPORT_CFM_FUNCTION MPWaitOnSemaphore
  145.     ENDIF
  146.  
  147.  
  148. ;
  149. ; extern OSStatus MPSignalSemaphore(MPSemaphoreID semaphore)
  150. ;
  151.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  152.         IMPORT_CFM_FUNCTION MPSignalSemaphore
  153.     ENDIF
  154.  
  155.  
  156. ;
  157. ; extern OSStatus MPDeleteSemaphore(MPSemaphoreID semaphore)
  158. ;
  159.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  160.         IMPORT_CFM_FUNCTION MPDeleteSemaphore
  161.     ENDIF
  162.  
  163.  
  164. ;
  165. ; extern OSStatus MPCreateCriticalRegion(MPCriticalRegionID *criticalRegion)
  166. ;
  167.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  168.         IMPORT_CFM_FUNCTION MPCreateCriticalRegion
  169.     ENDIF
  170.  
  171.  
  172. ;
  173. ; extern OSStatus MPEnterCriticalRegion(MPCriticalRegionID criticalRegion, Duration timeout)
  174. ;
  175.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  176.         IMPORT_CFM_FUNCTION MPEnterCriticalRegion
  177.     ENDIF
  178.  
  179.  
  180. ;
  181. ; extern OSStatus MPExitCriticalRegion(MPCriticalRegionID criticalRegion)
  182. ;
  183.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  184.         IMPORT_CFM_FUNCTION MPExitCriticalRegion
  185.     ENDIF
  186.  
  187.  
  188. ;
  189. ; extern OSStatus MPDeleteCriticalRegion(MPCriticalRegionID criticalRegion)
  190. ;
  191.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  192.         IMPORT_CFM_FUNCTION MPDeleteCriticalRegion
  193.     ENDIF
  194.  
  195.  
  196. ;
  197. ; extern LogicalAddress MPAllocate(ByteCount size)
  198. ;
  199.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  200.         IMPORT_CFM_FUNCTION MPAllocate
  201.     ENDIF
  202.  
  203. ;
  204. ; extern void MPFree(LogicalAddress object)
  205. ;
  206.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  207.         IMPORT_CFM_FUNCTION MPFree
  208.     ENDIF
  209.  
  210.  
  211. ;
  212. ; extern void MPBlockCopy(LogicalAddress sourcePtr, LogicalAddress destPtr, ByteCount blockSize)
  213. ;
  214.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  215.         IMPORT_CFM_FUNCTION MPBlockCopy
  216.     ENDIF
  217.  
  218.  
  219. ; **************************************************************************
  220. ; *
  221. ; *    MPTaskIsToolboxSafe() and MPRPC() were functions added by DayStar. 
  222. ; *    The 1.4 MPLibrary exports the names with an underscore prefix. 
  223. ; *    To work around this, #defines have been added to automatically
  224. ; *    add the underscore.
  225. ; *
  226.  
  227. ;  
  228. ;    MPTaskIsToolboxSafe() allows routines which are otherwise unaware that 
  229. ;    they are being called from an MP task to check to see if it is permissible
  230. ;    to make a call to the Macintosh toolbox.  (It is okay to make toolbox 
  231. ;    calls only if the routine is not being called from an MP task).
  232. ;
  233.  
  234. ;
  235. ; extern Boolean MPTaskIsToolboxSafe(MPTaskID task)
  236. ;
  237.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  238.         IMPORT_CFM_FUNCTION MPTaskIsToolboxSafe
  239.     ENDIF
  240.  
  241. ;    MPRPC() calls its MPRemoteProcedure parameter in the application's main 
  242. ;    thread when the app next calls WaitNextEvent, EventAvail, SystemTask, 
  243. ;    MPYield, MPWaitOnQueue, MPWaitOnSemaphore, or MPEnterCriticalRegion. The  
  244. ;    return value of the MPRemoteProcedure is returned as the result of MPRPC.  
  245. ;    The MPRemoteProcedure function can call any toolbox function except  
  246. ;    SystemTask (or anything that calls it).
  247. ;
  248.  
  249. ;
  250. ; extern void *MPRPC(MPRemoteProcedure theProc, void *parameter)
  251. ;
  252.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  253.         IMPORT_CFM_FUNCTION MPRPC
  254.     ENDIF
  255.  
  256.  
  257.  
  258. ; **************************************************************************
  259. ; *
  260. ; *    The following routines were added by DayStar for debugging purposes.
  261. ; *    You should not use these in shipping products.  You can tell which
  262. ; *    functions are for debugging only because they begin with an underscore
  263. ; *
  264.  
  265. ;
  266. ; extern Boolean _MPIsFullyInitialized(void )
  267. ;
  268.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  269.         IMPORT_CFM_FUNCTION _MPIsFullyInitialized
  270.     ENDIF
  271.  
  272.  
  273. ;    MPAllocateSys() does the same thing as MPAllocate() except the memory
  274. ;    is allocated from the system heap.
  275. ;
  276.  
  277. ;
  278. ; extern LogicalAddress _MPAllocateSys(ByteCount size)
  279. ;
  280.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  281.         IMPORT_CFM_FUNCTION _MPAllocateSys
  282.     ENDIF
  283.  
  284.  
  285. ;
  286. ; extern Boolean _MPLibraryIsCompatible(const char *versionCString, UInt32 major, UInt32 minor, UInt32 release, UInt32 revision)
  287. ;
  288.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  289.         IMPORT_CFM_FUNCTION _MPLibraryIsCompatible
  290.     ENDIF
  291.  
  292. ;    MPLibraryVersion() retrieves the hardcoded version information built into
  293. ;    the currently active Multiprocessing API Library.
  294. ;
  295.  
  296. ;
  297. ; extern void _MPLibraryVersion(const char **versionCString, UInt32 *major, UInt32 *minor, UInt32 *release, UInt32 *revision)
  298. ;
  299.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  300.         IMPORT_CFM_FUNCTION _MPLibraryVersion
  301.     ENDIF
  302.  
  303. ;
  304. ; extern void _MPInitializePrintf(MPPrintfHandler pfn)
  305. ;
  306.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  307.         IMPORT_CFM_FUNCTION _MPInitializePrintf
  308.     ENDIF
  309.  
  310. ;
  311. ; extern void _MPPrintf(const char *format, ...)
  312. ;
  313.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  314.         IMPORT_CFM_FUNCTION _MPPrintf
  315.     ENDIF
  316.  
  317.  
  318. ;     MPDebugStr() works just like DebugStr() except that it is safe
  319. ;    to call it from an MP task.
  320. ;
  321.  
  322. ;
  323. ; extern void _MPDebugStr(ConstStr255Param msg)
  324. ;
  325.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  326.         IMPORT_CFM_FUNCTION _MPDebugStr
  327.     ENDIF
  328.  
  329. ;
  330. ;    MPStatusPString() and MPStatusCString() provide a way to translate an OSStatus
  331. ;    value returned from one of the MP API calls into either a Pascal string or a
  332. ;    C string.  Thus, if an MPLibrary function returns an error then the application
  333. ;    (not a task) could use the following:
  334. ;
  335. ;    status = MPxxx( function_params );
  336. ;    DebugStr( MPStatusPString( status ) );
  337. ;    
  338. ;
  339.  
  340. ;
  341. ; extern StringPtr _MPStatusPString(OSStatus status)
  342. ;
  343.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  344.         IMPORT_CFM_FUNCTION _MPStatusPString
  345.     ENDIF
  346.  
  347. ;
  348. ; extern const char *_MPStatusCString(OSStatus status)
  349. ;
  350.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  351.         IMPORT_CFM_FUNCTION _MPStatusCString
  352.     ENDIF
  353.  
  354.  
  355.     ENDIF    ; TARGET_CPU_PPC
  356.     ENDIF ; __MULTIPROCESSING__ 
  357.  
  358.